home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: jlilley@ix.netcom.com (John Lilley)
- Newsgroups: comp.lang.c++
- Subject: Re: What is name-mangling? (mentioned in FAQ)
- Date: 18 Mar 1996 18:20:21 GMT
- Organization: Netcom
- Distribution: world
- Message-ID: <4ik9h5$14k@reader2.ix.netcom.com>
- References: <4ik3s1$j7q@alcor.usc.edu>
- NNTP-Posting-Host: den-co8-14.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Mon Mar 18 10:20:21 AM PST 1996
- X-Newsreader: WinVN 0.99.7
-
- In article <4ik3s1$j7q@alcor.usc.edu>, wawda@alcor.usc.edu says...
- >
- >Hi. One of the questions in the FAQ mentioned "name-mangling". The
- >question was about compatibility between different vendor's libraires
- >with a common name-mangling scheme. But what is "name-mangling"?
- >Thanks in advance,
-
-
- "Name-mangling" is the means by which a C++ compiler distinguishes
- overloaded functions (or methods of different class with the same
- base name) from each other. For example:
-
- class A { void foo() {} };
- class B { void foo() {} };
- void foo() {}
- void foo(int x) {}
-
- All of the foo's are distinct functions/methods and must not collide
- at link time, so the compiler maps them onto different names. The
- strategies vary from a deterministic hash for linkers with short
- external name limits, to elaborate "decorating" schemes that embed
- the type information of the function and its arguments in a clever way.
- The latter is obviously advantageous in that the names can
- be "unmangled" without the help of a separate table.
-
- You can see these names by compiling the above code and looking at
- the resulting symbols via whatever utility is available (DUMPBIN
- for VC++, nm on UNIX, etc.)
-
- john lilley
-
-
-